package com.zj.cglib;

import com.zj.service.Actor;
import com.zj.service.LiuDeHua;
import net.sf.cglib.core.DebuggingClassWriter;

public class TestCglib {

    public static void main(String[] args) {
        test3();
    }

    public static void test1(){
        //CGLIB生成目标代理类:查看底层逻辑
        System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY,"D:\\java\\myproject\\javaDesignMode\\com\\sun\\cglibProxy");
        Object proxyedObj = new StarEnhancer(Actor.class).CreatProxyedObj();
        Actor  liu= (Actor)proxyedObj;
        liu.sing("haha");
    }

    public static void test2(){
        System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY,"D:\\java\\myproject\\javaDesignMode\\com\\sun\\objenesis");
        Object proxyedObj = new StarEnhancer(Actor.class).CreatProxyedObj2();
        Actor  liu= (Actor)proxyedObj;
        liu.sing("haha");
    }

    public static void test3(){
        System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY,"D:\\java\\myproject\\javaDesignMode\\com\\sun\\objenesis");
        Object proxyedObj = new StarEnhancer(LiuDeHua.class).CreatProxyedObj3();
        LiuDeHua  liu= (LiuDeHua)proxyedObj;
        liu.sing("paomadeliuliu");
        liu.dance("paomadeliuliu");
        liu.eat("paomadeliuliu");
    }
}
